package com.efast.dmom.mes.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.efast.dmom.mes.bean.OperationWorkorder;
import com.efast.dmom.mes.bean.ProductionImplementation;
import com.efast.dmom.mes.bean.ProductionImplementationAccept;
import com.efast.dmom.mes.bean.ProductionImplementtationUser;
import com.efast.dmom.mes.bean.RouteStep;
import com.efast.dmom.mes.bean.WmsStorage;
import com.efast.dmom.mes.entity.OperationWorkorderEntity;
import com.efast.dmom.mes.entity.PartEntity;
import com.efast.dmom.mes.entity.PlanEntity;
import com.efast.dmom.mes.entity.ProductRouteEntity;
import com.efast.dmom.mes.service.ProductionImplementationService;

@Controller
@RequestMapping("/productionImplement")
public class ProductionImplementationController {

	@Autowired
	private ProductionImplementationService productionImplementationService;

	// 获取产品下拉框
	@RequestMapping(value = "/getProductionPart")
	public @ResponseBody List<ProductRouteEntity> getProductionPart() {
		return productionImplementationService.getProductionPart();
	}
	
	// 获取工序下拉框
	@RequestMapping(value = "/getAllRouteStepByRouteKey/{routeKey}")
	public @ResponseBody List<RouteStep> getAllRouteStepByRouteKey(@PathVariable long routeKey) {
		return productionImplementationService.getAllRouteStepByRouteKey(routeKey);
	}
	
	// 通过仓库id获取毛坯件下拉框
	@RequestMapping(value = "/getPartEntityList/{warehouseBasId}")
	public @ResponseBody List<PartEntity> getPartEntityList(@PathVariable long warehouseBasId) {
		return productionImplementationService.getPartEntityList(warehouseBasId);
	}
	
	// 确认查询
	@RequestMapping(value = "/confirm")
	public @ResponseBody ProductionImplementation confirm(@RequestBody ProductionImplementationAccept acceptBean) {
		return productionImplementationService.confirm(acceptBean);
	}

	// 获取用户下拉框,去重
	@RequestMapping(value = "/getUserName")
	public @ResponseBody List<ProductionImplementtationUser> getUserName() {
		return productionImplementationService.getUserName();
		
	}
	
	@RequestMapping(value = "/getwareHouser")
	public @ResponseBody List<WmsStorage>getwareHouser() {
		return productionImplementationService.getwareHouser();
	}
	
	@RequestMapping(value = "/getPlanOrderByPartId")
	public @ResponseBody List<PlanEntity> getPlanOrderByPartId(@RequestBody OperationWorkorder operationWorkorder) {
		return productionImplementationService.getPlanOrderByPartId(operationWorkorder);
	}
	@RequestMapping(value = "getOperationPlanByOperationAndPlan")
	public @ResponseBody List<OperationWorkorderEntity> getOperationPlanByOperationAndPlan(@RequestBody OperationWorkorderEntity operationWorkorderEntity) {
		
		return productionImplementationService.getOperationPlanByOperationAndPlan(operationWorkorderEntity);
	}
	
	
}
